import request from '@/utils/request'
import { IPage } from '@/model/interface/request'

// 获取全部角色列表
export const getRolesAPI = (params: IPage) =>
  request({
    url: '/sys/role',
    method: 'get',
    params
  })

// 获取id获取角色详情
export const getUserRolesAPI = (id: string) =>
  request({
    url: `/sys/role/${id}`
  })

export const createRole = (data: any) =>
  request({
    url: '/roles',
    method: 'post',
    data
  })

export const updateRole = (id: number, data: any) =>
  request({
    url: `/roles/${id}`,
    method: 'put',
    data
  })

export const deleteRole = (id: number) =>
  request({
    url: `/roles/${id}`,
    method: 'delete'
  })

export const getRoutes = (params: any) =>
  request({
    url: '/routes',
    method: 'get',
    params
  })
